<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        API Tester</h2>
    <ul>
        <li><a href='/admin/getusers?format=xml'>Get Users (xml)</a></li>
        <li><a href='/admin/getusers?format=json'>Get Users (json)</a></li>
        <li><a href='#' onclick="$.post('/admin/getusers',null,displayXml,'xml');">Get Users
            (post,xml)</a></li>
        <li><a href='#' onclick="$.post('/admin/getusers',null,displayJson,'json');">Get Users
            (post,json)</a></li>
        <li><a href='/api/testlogin?format=json'>Test login /api/testlogin?format=json</a></li>
        <li><a href='/api/testlogin?username=test&password=1234&format=xml'>Test login /api/testlogin?username=test&amp;password=1234&amp;format=xml</a></li>
        <li><a href='#' onclick="$.post('/api/testlogin',{username:'test',password:'1234'},displayXml,'xml');">
            Test login /api/testlogin (post,xml)</a></li>
        <li><a href='#' onclick="$.post('/api/testlogin',{username:'test',password:'1234'},displayJson,'json');">
            Test login /api/testlogin (post,json)</a></li>
        <li><a href='#' onclick="$.post('/api/testlogin',{username:'testsdsd',password:'1234'},displayXml,'xml');">
            Test login /api/testlogin (post,xml,fail)</a></li>
        <li><a href='#' onclick="$.post('/api/testlogin',{username:'testsdsd',password:'1234'},displayJson,'json');">
            Test login /api/testlogin (post,json,fail)</a></li>
    </ul>
    <textarea id='results' cols="40" rows="8"></textarea>

    <script type="text/javascript">
        function displayXml(data, text) {
            $("#results").empty();
            $("#results").val($(data).text());
        }

        function displayJson(data, text) {
            $("#results").empty();
            $("#results").val(JSON.stringify(data));
        }
    </script>

</asp:Content>
